package cn.neusoft.customer.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class CustomerProducer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendToQueue(String message) {
        log.info("Sending message to the queue. Message: {}", message);
        rabbitTemplate.convertAndSend("customerQueue", message);
        log.info("Message sent successfully.");
    }
}
